/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.feignimpl.member;

import com.enation.app.javashop.client.member.ConnectClient;
import com.enation.app.javashop.core.client.fallback.member.ConnectClientFallbackFactory;
import com.enation.app.javashop.core.handler.FeignConfiguration;
import com.enation.app.javashop.model.member.dos.ConnectDO;
import com.enation.app.javashop.model.payment.enums.WechatTypeEnmu;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * 第三方连接client
 *
 * @author zh
 * @version v7.0
 * @date 18/7/27 下午3:51
 * @since v7.0
 */
@FeignClient(name = "member-service", fallbackFactory = ConnectClientFallbackFactory.class,configuration = {FeignConfiguration.class})
public interface ConnectClientFeignImpl extends ConnectClient {

    /**
     * 获取 联合登录对象
     * @param memberId 会员id
     * @param unionType 类型
     * @return ConnectDO
     */
    @Override
    @RequestMapping(value = "/client/members/{member_id}/connect", method = RequestMethod.GET)
    ConnectDO getConnect(@PathVariable("member_id") Long memberId, @RequestParam("union_type") String unionType);

    /**
     * 获取会员的openId
     * @param memberId
     * @return
     */
    @Override
    @RequestMapping(value = "/client/members/{member_id}/open-id", method = RequestMethod.GET)
    String getMemberOpenid(@PathVariable("member_id")Long memberId);

    /**
     * 生成 CGI 接口 access token ，服务器与微信的接口token
     *
     * @param wechatTypeEnmu
     * @return
     */
    @Override
    @RequestMapping(value = "/client/members/cgi-access-token", method = RequestMethod.GET)
    String getCgiAccessToken(@RequestParam("wechat_type_enmu") WechatTypeEnmu wechatTypeEnmu);

    /**
     * 获取微信参数
     * @param wechatTypeEnmu
     * @return
     */
    @Override
    @RequestMapping(value = "/client/members/connect-config", method = RequestMethod.GET)
    Map getConnectConfig(@RequestParam("wechat_type_enmu")WechatTypeEnmu wechatTypeEnmu);

}
